package module3;

import java.util.HashMap;
import java.util.Set;

public class HashMapTest {

    public static void main(String[] args) {
        String str1 = "123,456,789,123,456,123";
        String[] str2 = str1.split("[,]");
        HashMap<String, Integer> hm1 = new HashMap<>();
        for(int i = 0; i < str2.length; i++) {
            Object obj = hm1.put(str2[i], 1);
            if(null != obj) {
                Object obj1 = hm1.get(str2[i]);
                hm1.put(str2[i], (Integer)obj1 + 1);
            }
        }
        Set s1 = hm1.entrySet();
        for (Object s : s1) {
            System.out.println(s);
        }

    }
}
